package com.createidea.cms.struts.action;

import java.io.File;
import java.util.List;

import com.createidea.cms.service.enterprise.EnterpriseService;
import com.createidea.cms.service.picture.PictureService;
import com.createidea.cms.to.EnterpriseTo;

public class EnterpriseAction extends BaseAction {
    private EnterpriseService enterpriseService;
    private EnterpriseTo enterprise;
    private List<EnterpriseTo> enterprises;
	private String enterpriseId;
	private PictureService pictureService;
	private String pictureId;
	
    public String maintainbaseinfo(){
    	enterprises=enterpriseService.getEnterprise();
    	return SUCCESS;
    }
    
    public String saveEnterprise(){
   
    	enterpriseService.saveEnterprise(enterprise);
    	return SUCCESS;
    }
    
    public String editEnterprise(){
    	
    	enterprise=enterpriseService.getEnterprise(enterpriseId);
    	return SUCCESS;
    }
    
    
    public String addEnterprise(){
    	
    	return SUCCESS;
    }
    
    public String updateEnterprise(){
    	enterpriseService.saveEnterprise(enterprise);
    	return SUCCESS;
    }
    
    public String loadIntroduction(){
    	enterprise=enterpriseService.getEnterpriseInfo();
    	enterprise.setPictures(pictureService.getPicturesForObject(enterprise.getId()));
    	return SUCCESS;
    }
    
    public String setPictureAsDefault(){
    	enterpriseService.setPictureAsDefault(enterpriseId,pictureId);
    	return SUCCESS;
    }
    /*
     * set and get methods
     */
	public EnterpriseService getEnterpriseService() {
		return enterpriseService;
	}

	public void setEnterpriseService(EnterpriseService enterpriseService) {
		this.enterpriseService = enterpriseService;
	}

	public EnterpriseTo getEnterprise() {
		return enterprise;
	}

	public void setEnterprise(EnterpriseTo enterprise) {
		this.enterprise = enterprise;
	}

	public String getEnterpriseId() {
		return enterpriseId;
	}

	public void setEnterpriseId(String enterpriseId) {
		this.enterpriseId = enterpriseId;
	}

	public List<EnterpriseTo> getEnterprises() {
		return enterprises;
	}

	public void setEnterprises(List<EnterpriseTo> enterprises) {
		this.enterprises = enterprises;
	}

	public PictureService getPictureService() {
		return pictureService;
	}

	public void setPictureService(PictureService pictureService) {
		this.pictureService = pictureService;
	}

	public String getPictureId() {
		return pictureId;
	}

	public void setPictureId(String pictureId) {
		this.pictureId = pictureId;
	}
    
    
    
}
